package com.pagemodel.dwr;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.TreeMap;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

public class MyDWR {
	public Double add(double a,double b) {
		System.out.println(a+b);
		return a+b;
	}
	
	public String getList(String json){
		TreeMap<String,String> map = JSON.parseObject(json, new TypeReference<TreeMap<String,String>>(){});
		System.out.println(map);
		Object value = null;
		Iterator<?> it = map.entrySet().iterator();
		System.out.println(it.hasNext());
		while(it.hasNext()) {
			Map.Entry<String,String> en = (Map.Entry<String,String>) it.next();
			if(map.lastKey() == en.getKey()) {
				System.out.println("map.lastKey():"+map.lastKey());
				System.out.println("en.getKey():"+en.getKey());
				return en.getValue();
			}
		}
//		it = list.listIterator();
//		
//		if(it.hasNext()) {
//			value = it.next();
//		}
		return value==null?"":value.toString();
	}
	
}
